Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist/tools/uf2: add target to also copy families.json file #20042

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

MichelRottleuthner
Copy link
Contributor

Contribution description

The updated UF2 pkg (#20035) stores the family ID in an external .json file. I overlooked that and flashing fails if this file is not present. This PR fixes it by also copying the json into the tool folder.

Testing procedure

Check if the feather-nrf52840-sense can be flashed when the new UF2 pkg is cloned freshly.

Issues/PRs references

Fixes a regression introduced with #20035

@MichelRottleuthner MichelRottleuthner added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) Area: pkg Area: External package ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels Nov 2, 2023
@github-actions github-actions bot added Area: tools Area: Supplementary tools and removed Area: pkg Area: External package ports labels Nov 2, 2023
Copy link
Contributor

@MrKevinWeiss MrKevinWeiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, tested after removing the file:

weiss@mobiweiss:~/repos/RIOT$ rm dist/tools/uf2/uf2conv.py 
weiss@mobiweiss:~/repos/RIOT$ BOARD=feather-nrf52840-sense make flash -C examples/hello-world/
make: Entering directory '/home/weiss/repos/RIOT/examples/hello-world'
Building application "hello-world" for "feather-nrf52840-sense" with MCU "nrf52".

"make" -C /home/weiss/repos/RIOT/pkg/cmsis/ 
"make" -C /home/weiss/repos/RIOT/boards/common/init
"make" -C /home/weiss/repos/RIOT/boards/feather-nrf52840-sense
"make" -C /home/weiss/repos/RIOT/core
"make" -C /home/weiss/repos/RIOT/core/lib
"make" -C /home/weiss/repos/RIOT/cpu/nrf52
"make" -C /home/weiss/repos/RIOT/cpu/cortexm_common
"make" -C /home/weiss/repos/RIOT/cpu/cortexm_common/periph
"make" -C /home/weiss/repos/RIOT/cpu/nrf52/periph
"make" -C /home/weiss/repos/RIOT/cpu/nrf52/vectors
"make" -C /home/weiss/repos/RIOT/cpu/nrf5x_common
"make" -C /home/weiss/repos/RIOT/cpu/nrf5x_common/periph
"make" -C /home/weiss/repos/RIOT/drivers
"make" -C /home/weiss/repos/RIOT/drivers/periph_common
"make" -C /home/weiss/repos/RIOT/sys
"make" -C /home/weiss/repos/RIOT/sys/auto_init
"make" -C /home/weiss/repos/RIOT/sys/auto_init/usb
"make" -C /home/weiss/repos/RIOT/sys/div
"make" -C /home/weiss/repos/RIOT/sys/event
"make" -C /home/weiss/repos/RIOT/sys/fmt
"make" -C /home/weiss/repos/RIOT/sys/isrpipe
"make" -C /home/weiss/repos/RIOT/sys/libc
"make" -C /home/weiss/repos/RIOT/sys/luid
"make" -C /home/weiss/repos/RIOT/sys/malloc_thread_safe
"make" -C /home/weiss/repos/RIOT/sys/newlib_syscalls_default
"make" -C /home/weiss/repos/RIOT/sys/preprocessor
"make" -C /home/weiss/repos/RIOT/sys/tsrb
"make" -C /home/weiss/repos/RIOT/sys/usb/usbus
"make" -C /home/weiss/repos/RIOT/sys/usb/usbus/cdc/acm
"make" -C /home/weiss/repos/RIOT/sys/usb_board_reset
   text	   data	    bss	    dec	    hex	filename
  18424	    128	   4576	  23128	   5a58	/home/weiss/repos/RIOT/examples/hello-world/bin/feather-nrf52840-sense/hello-world.elf
stty -F /dev/ttyACM0 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255
sleep 3
[INFO] uf2conv.py not found - fetching it from GitHub now
CC= CFLAGS= make -C /home/weiss/repos/RIOT/dist/tools/uf2
cp /home/weiss/repos/RIOT/build/pkg/UF2/utils/uf2conv.py .
chmod a+x uf2conv.py
cp /home/weiss/repos/RIOT/build/pkg/UF2/utils/uf2families.json .
[INFO] uf2conv.py successfully fetched!
/home/weiss/repos/RIOT/dist/tools/uf2/uf2conv.py -f 0xADA52840 /home/weiss/repos/RIOT/examples/hello-world/bin/feather-nrf52840-sense/hello-world.hex --base 0x1000
Converted to uf2, output size: 37376, start address: 0x1000
Flashing /media/weiss/FTHRSNSBOOT (nRF52840-Feather-Sense)
Wrote 37376 bytes to /media/weiss/FTHRSNSBOOT/NEW.UF2
make: Leaving directory '/home/weiss/repos/RIOT/examples/hello-world'

@MrKevinWeiss
Copy link
Contributor

bors merge

Copy link
Contributor

bors bot commented Nov 2, 2023

🕐 Waiting for PR status (GitHub check) to be set, probably by CI. Bors will automatically try to run when all required PR statuses are set.

Copy link
Contributor

bors bot commented Nov 2, 2023

GitHub status checks took too long to complete, so bors is giving up. You can adjust bors configuration to have it wait longer if you like.

@riot-ci
Copy link

riot-ci commented Nov 2, 2023

Murdock results

✔️ PASSED

1e6ac1f dist/tools/uf2: add target to also copy families.json file

Success Failures Total Runtime
1 0 1 01m:14s

Artifacts

@maribu maribu added the CI: ready for merge train 🚃 PR is ready to be merged and awaiting the next merge train label Nov 2, 2023
@MrKevinWeiss
Copy link
Contributor

bors merge

bors bot added a commit that referenced this pull request Nov 2, 2023
19932: tests/periph: Add test using the Peripheral Selftest Shield r=MrKevinWeiss a=maribu

### Contribution description

This adds a test that makes use of the peripheral selftesting shield.

#### ToDo

- [x] Add doc

### Testing procedure

- grab an Arduino UNO compatible board that has the Arduino pin map feature
- connect it to the testing shield
- configure the testing shield
    - make sure the VCC selector matches the logic level of the board (3.3V and 5V are the only options)
    - enabled all the "loops" needed for testing on SW1
    - it could be that the UART on D0, D1 is used for stdio. In that case, do *NOT* close the loop
- flash and run the test application

### Issues/PRs references

none

19992: sys/psa_crypto: Fix build problems r=MrKevinWeiss a=Einhornhool

### Contribution description
This fixes several problems:

#### 1. Empty union in cipher context when `MODULE_PSA_CIPHER` is not selected.
PSA operations are now separated into modules. Functions and contexts are only built when the corresponding module is selected. This way there won't be problems with missing or unitialized structures in unused modules anymore.

#### 2. Zero-size array when using secure elements and `PSA_MAX_KEY_DATA_SIZE == 0`
I added a condition to the `psa_key_slot_t` structure in `psa_key_slot_management.h`.
Also the existence of key slot management functions and key slot structures now depends on the number of allocated key slots instead of selected modules.
This way key structures will not exist unless they are used.

### Testing procedure
Add the following to `examples/hello_world/Makefile` and call make : 
```
USEMODULE += psa_crypto
USEMODULE += psa_hash
USEMODULE += psa_hash_sha_256
USEMODULE += psa_secure_element
```
Output on Master:
```
"make" -C /home/lena/work/RIOT/boards/common/init
"make" -C /home/lena/work/RIOT/boards/native
"make" -C /home/lena/work/RIOT/boards/native/drivers
"make" -C /home/lena/work/RIOT/core
"make" -C /home/lena/work/RIOT/core/lib
"make" -C /home/lena/work/RIOT/cpu/native
"make" -C /home/lena/work/RIOT/cpu/native/periph
"make" -C /home/lena/work/RIOT/cpu/native/stdio_native
"make" -C /home/lena/work/RIOT/drivers
"make" -C /home/lena/work/RIOT/drivers/periph_common
"make" -C /home/lena/work/RIOT/sys
"make" -C /home/lena/work/RIOT/sys/auto_init
"make" -C /home/lena/work/RIOT/sys/libc
"make" -C /home/lena/work/RIOT/sys/luid
"make" -C /home/lena/work/RIOT/sys/preprocessor
"make" -C /home/lena/work/RIOT/sys/psa_crypto
In file included from /home/lena/work/RIOT/sys/include/psa_crypto/psa/crypto.h:39,
                 from /home/lena/work/RIOT/sys/psa_crypto/psa_crypto_algorithm_dispatch.c:23:
/home/lena/work/RIOT/sys/include/psa_crypto/psa/crypto_struct.h:137:11: error: union has no members [-Werror=pedantic]
  137 |     union cipher_context {
      |           ^~~~~~~~~~~~~~
In file included from /home/lena/work/RIOT/sys/psa_crypto/include/psa_crypto_operation_encoder.h:32,
                 from /home/lena/work/RIOT/sys/psa_crypto/psa_crypto_algorithm_dispatch.c:28:
/home/lena/work/RIOT/sys/psa_crypto/include/psa_crypto_slot_management.h:82:17: error: ISO C forbids zero-size array ‘data’ [-Werror=pedantic]
   82 |         uint8_t data[PSA_MAX_KEY_DATA_SIZE];    /**< Key data buffer */
      |                 ^~~~
cc1: all warnings being treated as errors
make[3]: *** [/home/lena/work/RIOT/Makefile.base:146: /home/lena/work/RIOT/examples/hello-world/bin/native/psa_crypto/psa_crypto_algorithm_dispatch.o] Error 1
make[2]: *** [/home/lena/work/RIOT/Makefile.base:31: ALL--/home/lena/work/RIOT/sys/psa_crypto] Error 2
make[1]: *** [/home/lena/work/RIOT/Makefile.base:31: ALL--/home/lena/work/RIOT/sys] Error 2
make: *** [/home/lena/work/RIOT/examples/hello-world/../../Makefile.include:761: application_hello-world.module] Error 2
```
Output with fixes:
```
"make" -C /home/lena/work/RIOT/boards/common/init
"make" -C /home/lena/work/RIOT/boards/native
"make" -C /home/lena/work/RIOT/boards/native/drivers
"make" -C /home/lena/work/RIOT/core
"make" -C /home/lena/work/RIOT/core/lib
"make" -C /home/lena/work/RIOT/cpu/native
"make" -C /home/lena/work/RIOT/cpu/native/periph
"make" -C /home/lena/work/RIOT/cpu/native/stdio_native
"make" -C /home/lena/work/RIOT/drivers
"make" -C /home/lena/work/RIOT/drivers/periph_common
"make" -C /home/lena/work/RIOT/sys
"make" -C /home/lena/work/RIOT/sys/auto_init
"make" -C /home/lena/work/RIOT/sys/libc
"make" -C /home/lena/work/RIOT/sys/luid
"make" -C /home/lena/work/RIOT/sys/preprocessor
"make" -C /home/lena/work/RIOT/sys/psa_crypto
"make" -C /home/lena/work/RIOT/sys/psa_crypto/psa_key_slot_mgmt
"make" -C /home/lena/work/RIOT/sys/psa_crypto/psa_se_mgmt
"make" -C /home/lena/work/RIOT/sys/random
/usr/bin/ld: warning: /home/lena/work/RIOT/examples/hello-world/bin/native/hello-world.elf has a LOAD segment with RWX permissions
   text	   data	    bss	    dec	    hex	filename
  29764	    584	  47856	  78204	  1317c	/home/lena/work/RIOT/examples/hello-world/bin/native/hello-world.elf
```

20042: dist/tools/uf2: add target to also copy families.json file r=MrKevinWeiss a=MichelRottleuthner

### Contribution description

The updated UF2 pkg (#20035) stores the family ID in an external .json file. I overlooked that and flashing fails if this file is not present. This PR fixes it by also copying the json into the tool folder.

### Testing procedure
Check if the `feather-nrf52840-sense` can be flashed when the new UF2 pkg is cloned freshly.


### Issues/PRs references
 Fixes a regression introduced with #20035 


Co-authored-by: Marian Buschsieweke <marian.buschsieweke@posteo.net>
Co-authored-by: Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
Co-authored-by: Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
Copy link
Contributor

bors bot commented Nov 3, 2023

Build failed (retrying...):

bors bot added a commit that referenced this pull request Nov 3, 2023
19992: sys/psa_crypto: Fix build problems r=MrKevinWeiss a=Einhornhool

### Contribution description
This fixes several problems:

#### 1. Empty union in cipher context when `MODULE_PSA_CIPHER` is not selected.
PSA operations are now separated into modules. Functions and contexts are only built when the corresponding module is selected. This way there won't be problems with missing or unitialized structures in unused modules anymore.

#### 2. Zero-size array when using secure elements and `PSA_MAX_KEY_DATA_SIZE == 0`
I added a condition to the `psa_key_slot_t` structure in `psa_key_slot_management.h`.
Also the existence of key slot management functions and key slot structures now depends on the number of allocated key slots instead of selected modules.
This way key structures will not exist unless they are used.

### Testing procedure
Add the following to `examples/hello_world/Makefile` and call make : 
```
USEMODULE += psa_crypto
USEMODULE += psa_hash
USEMODULE += psa_hash_sha_256
USEMODULE += psa_secure_element
```
Output on Master:
```
"make" -C /home/lena/work/RIOT/boards/common/init
"make" -C /home/lena/work/RIOT/boards/native
"make" -C /home/lena/work/RIOT/boards/native/drivers
"make" -C /home/lena/work/RIOT/core
"make" -C /home/lena/work/RIOT/core/lib
"make" -C /home/lena/work/RIOT/cpu/native
"make" -C /home/lena/work/RIOT/cpu/native/periph
"make" -C /home/lena/work/RIOT/cpu/native/stdio_native
"make" -C /home/lena/work/RIOT/drivers
"make" -C /home/lena/work/RIOT/drivers/periph_common
"make" -C /home/lena/work/RIOT/sys
"make" -C /home/lena/work/RIOT/sys/auto_init
"make" -C /home/lena/work/RIOT/sys/libc
"make" -C /home/lena/work/RIOT/sys/luid
"make" -C /home/lena/work/RIOT/sys/preprocessor
"make" -C /home/lena/work/RIOT/sys/psa_crypto
In file included from /home/lena/work/RIOT/sys/include/psa_crypto/psa/crypto.h:39,
                 from /home/lena/work/RIOT/sys/psa_crypto/psa_crypto_algorithm_dispatch.c:23:
/home/lena/work/RIOT/sys/include/psa_crypto/psa/crypto_struct.h:137:11: error: union has no members [-Werror=pedantic]
  137 |     union cipher_context {
      |           ^~~~~~~~~~~~~~
In file included from /home/lena/work/RIOT/sys/psa_crypto/include/psa_crypto_operation_encoder.h:32,
                 from /home/lena/work/RIOT/sys/psa_crypto/psa_crypto_algorithm_dispatch.c:28:
/home/lena/work/RIOT/sys/psa_crypto/include/psa_crypto_slot_management.h:82:17: error: ISO C forbids zero-size array ‘data’ [-Werror=pedantic]
   82 |         uint8_t data[PSA_MAX_KEY_DATA_SIZE];    /**< Key data buffer */
      |                 ^~~~
cc1: all warnings being treated as errors
make[3]: *** [/home/lena/work/RIOT/Makefile.base:146: /home/lena/work/RIOT/examples/hello-world/bin/native/psa_crypto/psa_crypto_algorithm_dispatch.o] Error 1
make[2]: *** [/home/lena/work/RIOT/Makefile.base:31: ALL--/home/lena/work/RIOT/sys/psa_crypto] Error 2
make[1]: *** [/home/lena/work/RIOT/Makefile.base:31: ALL--/home/lena/work/RIOT/sys] Error 2
make: *** [/home/lena/work/RIOT/examples/hello-world/../../Makefile.include:761: application_hello-world.module] Error 2
```
Output with fixes:
```
"make" -C /home/lena/work/RIOT/boards/common/init
"make" -C /home/lena/work/RIOT/boards/native
"make" -C /home/lena/work/RIOT/boards/native/drivers
"make" -C /home/lena/work/RIOT/core
"make" -C /home/lena/work/RIOT/core/lib
"make" -C /home/lena/work/RIOT/cpu/native
"make" -C /home/lena/work/RIOT/cpu/native/periph
"make" -C /home/lena/work/RIOT/cpu/native/stdio_native
"make" -C /home/lena/work/RIOT/drivers
"make" -C /home/lena/work/RIOT/drivers/periph_common
"make" -C /home/lena/work/RIOT/sys
"make" -C /home/lena/work/RIOT/sys/auto_init
"make" -C /home/lena/work/RIOT/sys/libc
"make" -C /home/lena/work/RIOT/sys/luid
"make" -C /home/lena/work/RIOT/sys/preprocessor
"make" -C /home/lena/work/RIOT/sys/psa_crypto
"make" -C /home/lena/work/RIOT/sys/psa_crypto/psa_key_slot_mgmt
"make" -C /home/lena/work/RIOT/sys/psa_crypto/psa_se_mgmt
"make" -C /home/lena/work/RIOT/sys/random
/usr/bin/ld: warning: /home/lena/work/RIOT/examples/hello-world/bin/native/hello-world.elf has a LOAD segment with RWX permissions
   text	   data	    bss	    dec	    hex	filename
  29764	    584	  47856	  78204	  1317c	/home/lena/work/RIOT/examples/hello-world/bin/native/hello-world.elf
```

20042: dist/tools/uf2: add target to also copy families.json file r=MrKevinWeiss a=MichelRottleuthner

### Contribution description

The updated UF2 pkg (#20035) stores the family ID in an external .json file. I overlooked that and flashing fails if this file is not present. This PR fixes it by also copying the json into the tool folder.

### Testing procedure
Check if the `feather-nrf52840-sense` can be flashed when the new UF2 pkg is cloned freshly.


### Issues/PRs references
 Fixes a regression introduced with #20035 


Co-authored-by: Lena Boeckmann <lena.boeckmann@haw-hamburg.de>
Co-authored-by: Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
Copy link
Contributor

bors bot commented Nov 3, 2023

Build failed (retrying...):

Copy link
Contributor

bors bot commented Nov 3, 2023

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot merged commit 4250c15 into RIOT-OS:master Nov 3, 2023
30 checks passed
@MrKevinWeiss MrKevinWeiss added this to the Release 2024.01 milestone Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: ready for merge train 🚃 PR is ready to be merged and awaiting the next merge train Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants